<script setup lang="ts">
  import UserForm from './components/UserForm.vue'
  import DataTable from './components/DataTable.vue'
  import TaskManager from './components/TaskManager.vue'
  import { ref } from 'vue'

  const activeTab = ref('form')
</script>

<template>
  <div class="app-container">
    <header>
      <h1>Vue3 + ESLint测试组件</h1>
      <nav class="tabs">
        <button @click="activeTab = 'form'" :class="{ active: activeTab === 'form' }">
          表单组件
        </button>
        <button @click="activeTab = 'table'" :class="{ active: activeTab === 'table' }">
          表格组件
        </button>
        <button @click="activeTab = 'tasks'" :class="{ active: activeTab === 'tasks' }">
          任务管理器
        </button>
      </nav>
    </header>

    <main>
      <div v-if="activeTab === 'form'" class="component-container">
        <UserForm @submit="data => console.info('表单提交:', data)" />
      </div>

      <div v-if="activeTab === 'table'" class="component-container">
        <DataTable />
      </div>

      <div v-if="activeTab === 'tasks'" class="component-container">
        <TaskManager title="Vue3任务管理器" />
      </div>
    </main>
  </div>
</template>

<style>
  /* 全局样式 */
  body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    margin: 0;
    padding: 0;
    color: #333;
    background-color: #f5f5f5;
  }

  /* 应用容器样式 */
  .app-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
  }

  header {
    margin-bottom: 30px;
    text-align: center;
  }

  header h1 {
    margin-bottom: 20px;
    color: #2c3e50;
  }

  .tabs {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 20px;
  }

  .tabs button {
    padding: 10px 20px;
    border: 1px solid #ddd;
    border-radius: 5px;
    background: #fff;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s ease;
  }

  .tabs button.active {
    background: #42b983;
    color: #fff;
    border-color: #42b983;
  }

  .tabs button:hover:not(.active) {
    background: #f0f0f0;
  }

  .component-container {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    min-height: 400px;
  }
</style>
